package com.zztl.infiniteBand.net



import com.zztl.infiniteBand.net.imp.DownLoadListener
import okhttp3.Interceptor
import okhttp3.Response
import java.io.IOException


/**
 * @desc   //添加进度条展示
 * @auth ${user}
 * @time 2018/3/16  13:59
 */

class DownLoadInterceptor(var mLoadListener: DownLoadListener) : Interceptor {

    @Throws(IOException::class)
    override fun intercept(chain: Interceptor.Chain): Response {
        val request = chain.request()
        val response = chain.proceed(request)
        return response.newBuilder().body(LoadResponseBody(response.body(), mLoadListener))
                .build()
    }
}
